package enumandlambda;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author shkstart
 * 手动锁的基本使用
 * @create 2022-12-04-17:18
 */
public class  ThreadLock {
    public static void main(String[] args) {
        //1.创建锁对象
        Lock lock = new ReentrantLock();

        //2.加锁操作
        lock.lock();
        try {
            System.out.println("你好 reentrantlock");
        }finally {
            //3.释放锁
            lock.unlock();
        }

    }
}
